package feeinterface.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ulwx.tool.DbUtils;

import feeinterface.modeldb.ServiceCoOpenProvince;

public class ServiceCoOpenProvinceDao {

	public static List<ServiceCoOpenProvince> getBy(int CoID) throws Exception {

		String sql = "select * from ServiceCoOpenProvince where ServiceCoID=?";
		Map<Integer, Object> map = new HashMap<Integer, Object>();
		map.put(1, CoID);

		List<ServiceCoOpenProvince> list = DbUtils.doQueryClass(null,
				ServiceCoOpenProvince.class, sql, map);
		return list;
	}

	public static boolean IsCloseInProvince(int CoID, int provinceID)
			throws Exception {

		String sql = "select * from ServiceCo a,ServiceCoOpenProvince b "
				+ " where a.ServiceCoSno=b.ServiceCoID and b.ServiceCoID=?"
				+ " and a.Enable=1 and b.ProvinceID=? " ;
		
		Map<Integer, Object> map = new HashMap<Integer, Object>();
		map.put(1, CoID);
		map.put(2, provinceID);
		List<ServiceCoOpenProvince> list = DbUtils.doQueryClass(null,
				ServiceCoOpenProvince.class, sql, map);
		if (list.size() > 0)
			return false;
		return true;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
